package com.witmob.drivers.util;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.witmob.drivers.R;

/**
 * 工具类
 * */
public class DefultUtil {

	
//  LinearLaout   开始的数目paramInt1    总数paramInt2    Context
	public static void setProgressBar(LinearLayout paramLinearLayout, 
			int paramInt1, int paramInt2, Context paramContext)
	{
	    paramLinearLayout.removeAllViews();
	    int i3 = paramInt2 % 10;
	    int i5 = paramInt2 / 10;  //总页数
	    int i2;
	    ImageView localImageView1;
	    
	    /**
	     * 开始计算，
	     * 如果开始的数目大于10 则显示左按钮left_indicator
	     * 开始数目 到总数的数目大于10则显示右按钮right_indicator
	     * 
	     * 选中的数目显示page_indicator_focused
	     * 非选中的显示 page_indicator
	     * 
	     * 
	     * */
	    
	    if(i5 == 0){
	    	//总数小于10的情况下
		    i2 = paramInt1;
		    for(int tem = 0;tem<i3;tem++){
			   if(tem == i2){
				   localImageView1 = new ImageView(paramContext);
				   LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
				   localLayoutParams.leftMargin = 10;
				   localImageView1.setLayoutParams(localLayoutParams);
				   localImageView1.setImageResource(R.drawable.page_indicator_focused);
				   paramLinearLayout.addView(localImageView1);
			   }else{
				   	localImageView1 = new ImageView(paramContext);
				   	LinearLayout.LayoutParams localLayoutParams2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
				   	localLayoutParams2.leftMargin = 10;
					localImageView1.setLayoutParams(localLayoutParams2);
					localImageView1.setImageResource(R.drawable.page_indicator);
			    	paramLinearLayout.addView(localImageView1);
			   }
		    }
	    } 
	}
}
